﻿using System;
using PTop.Domain.ViewModel.Wechat;

namespace PTop.Front.Areas.Wechat.Models
{
    public class CustomerMessage : WechatMsgBase
    {
        /// <summary>
        /// 接收消息模版
        /// </summary>
        private static string _template;
        public override string MsgType
        {
            get { return "transfer_customer_service"; }
        }

        public override string Template
        {
            get
            {
                if (string.IsNullOrEmpty(_template))
                {
                    _template = @"<xml>
                                <ToUserName><![CDATA[{0}]]></ToUserName>
                                <FromUserName><![CDATA[{1}]]></FromUserName>
                                <CreateTime>{2}</CreateTime>
                                <MsgType><![CDATA[transfer_customer_service]]></MsgType>
                            </xml>";
                }

                return _template;
            }
        }

        public override string HandleRequest()
        {
            throw new NotImplementedException();
        }
        public string GenerateContent()
        {
            this.CreateTime = WeChatCommon.GetNowTime();
            return string.Format(this.Template, this.ToUserName, this.FromUserName, this.CreateTime);
        }
    }
}